package com.xq.jltx.kotlinlearn08

import retrofit2.Call
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import retrofit2.http.GET

/**
 * @author jltxseo
 *         Created by junlintianxia on 2017/06/15.
 */

//产生Retrofit访问接口
interface GitHubService{

    @GET("/repos/enbandari/Kotlin-Tutorials/stargazers")
    fun getStartGazers(): Call<List<User>>
}

object Service{
    val gitHubService: GitHubService by lazy {
        Retrofit.Builder().baseUrl("https://api.github.com")
                .addConverterFactory(GsonConverterFactory.create())
                .build()
                .create(GitHubService::class.java)
    }
}


fun main(args: Array<String>){
    Service.gitHubService.getStartGazers().execute().body()?.map {
        println(it)
    }
}